package com.luyun.frogpay.base.dagger.activity.module;

import android.app.Activity;
import android.content.Context;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.luyun.frogpay.base.annotator.ContextForActivity;
import com.luyun.frogpay.base.annotator.PerformActivity;

import javax.inject.Named;

import dagger.Module;
import dagger.Provides;

/**
 * @author 无人区
 * @date 2019/10/27 15:02
 * @desc:
 */
@Module
public class ActivityModule {
    private Activity activity;

    public ActivityModule(Activity activity) {
        this.activity = activity;
    }

    @PerformActivity
    @Provides
    @ContextForActivity
    public Context provideActivityContext(){
        return activity;
    }

    @PerformActivity
    @Provides
    public Activity provideActivity(){
        return activity;
    }

    @Named(value = "llmVertical")
    @PerformActivity
    @Provides
    public LinearLayoutManager provideVerticalLinearLayoutManager(){
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(activity);
        linearLayoutManager.setOrientation(RecyclerView.VERTICAL);
        return linearLayoutManager;
    }

    @Named(value = "llmHorizontal")
    @PerformActivity
    @Provides
    public LinearLayoutManager provideHorizontalLinearLayoutManager(){
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(activity);
        linearLayoutManager.setOrientation(RecyclerView.HORIZONTAL);
        return linearLayoutManager;
    }
}
